cmake_minimum_required(VERSION 2.8)
project(g729c)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter")

set(COMMON_SOURCE_FILES
        src/bits.c
        src/filter.c
        src/gainpred.c
        src/lspgetq.c
        src/pred_lt3.c
        src/pre_proc.c
        src/p_parity.c
        src/qua_lsp.c
        src/qua_gain.c
        src/util.c
        src/cor_func.c
        src/taming.c
        src/de_acelp.c
        src/dec_gain.c
        src/dec_lag3.c
        src/lspdec.c
        src/post_pro.c
        src/typedef.h
        src/version.h

        src/g729.c src/g729.h
        )

set(g729k_SOURCE_FILES
        src/cod_ld8k.c
        src/acelp_co.c
        src/lpc.c
        src/lpcfunc.c
        src/pitch.c
        src/tab_ld8k.h
        src/tab_ld8k.c
        src/pwf.c
        src/postfil.c
        src/dec_ld8k.c
        src/ld8k.h

        src/g729k.c src/g729k.h
        )

set(g729a_SOURCE_FILES
        src/cod_ld8a.c
        src/acelp_ca.c
        src/lpca.c
        src/lpcfunca.c
        src/pitch_a.c
        src/tab_ld8a.h
        src/tab_ld8a.c
        src/postfila.c
        src/dec_ld8a.c
        src/ld8a.h

        src/g729a.c src/g729a.h
        )


add_library(g729k ${COMMON_SOURCE_FILES} ${g729k_SOURCE_FILES})
add_library(g729a ${COMMON_SOURCE_FILES} ${g729a_SOURCE_FILES})
SET_TARGET_PROPERTIES(g729a
        PROPERTIES COMPILE_FLAGS "-DVER_G729A")


add_executable(coder src/coder.c)
target_link_libraries(
        coder
        g729k
        m
)

add_executable(decoder src/decoder.c)
target_link_libraries(
        decoder
        g729k
        m
)

add_executable(codera src/codera.c)
target_link_libraries(
        codera
        g729a
        m
)

add_executable(decodera src/decodera.c)
target_link_libraries(
        decodera
        g729a
        m
)